Skip to content

fix: resolve failing tests and type errors across api and shared packages#54

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2354-1781493689
Open

fix: resolve failing tests and type errors across api and shared packages#54
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2354-1781493689

Conversation

@stooit

@stooit stooit commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript errors in the multi-package repo. Final state: 22/22 tests pass, tsc --noEmit reports 0 errors.

Bugs fixed

  • Auth middleware case-sensitivity (packages/api/src/middleware/auth.ts) — the public-methods check compared against "post" while Hono supplies "POST", so POST /users was wrongly treated as protected (401 instead of 201). Fixed the comparison.
  • Missing import (packages/api/src/routes/users.ts) — badRequest was used but never imported, causing a ReferenceError (500 instead of 400). Added it to the import from ../lib/errors.
  • Inconsistent shared type (packages/shared/src/types.ts) — User.userName was renamed to username to match the route handlers and tests.
  • Unimplemented pagination (packages/shared/src/utils/pagination.ts) — implemented the paginate() stub to satisfy the full contract (slicing, total, totalPages, page/pageSize, empty arrays, out-of-range pages), with Math.max(1, Math.floor(page)) page clamping.
  • Type resolution (tsconfig.json) — wired up the already-installed bun/node types so process and bun:test resolve.

Constraints honoured

  • No test files modified.
  • No new dependencies added.
  • Only source files + tsconfig changed (5 files, +11/-19).

Verification

  • bun test → 22 pass / 0 fail
  • npx tsc --noEmit → exit 0, no errors

…ages

- auth middleware: fix case-sensitive HTTP method check so POST /users is public
- users route: import missing badRequest error helper (was 500, now 400)
- shared types: rename User.userName -> username to match consumers
- shared: implement paginate() utility (was a stub) with page clamping
- tsconfig: wire up bun/node types to resolve process and bun:test errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant